﻿@model OnlineBookstore.Models.AdministrationInfo

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理 - 添加管理员</title>
    <style>
        /* 基础样式 */
        body {
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
            margin: 0;
            padding: 0;
        }

        /* 布局样式 */
        #all {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .container {
            width: 100%;
            max-width: 1000px;
            margin: 0 auto;
            padding: 0 15px;
            flex: 1;
        }

        /* 头部样式 */
        #header {
            background-color: #2c3e50;
            color: white;
            padding: 15px 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        #logo {
            padding-left: 20px;
        }

        #logotxt {
            font-size: 24px;
            font-weight: bold;
        }

        #loginmsg {
            padding-right: 20px;
        }

        #loginmsg a {
            color: white;
            text-decoration: none;
            transition: opacity 0.3s;
        }

        #loginmsg a:hover {
            opacity: 0.8;
            text-decoration: underline;
        }

        /* 菜单样式 */
        #menu {
            background-color: #34495e;
            padding: 10px 0;
        }

        #menu ul {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 15px;
        }

        #menu li a {
            color: white;
            text-decoration: none;
            padding: 5px 10px;
            border-radius: 4px;
            transition: background-color 0.3s;
            font-size: 14px;
        }

        #menu li a:hover {
            background-color: rgba(255,255,255,0.1);
        }

        /* 表单样式 */
        .form-container {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 0 15px rgba(0,0,0,0.05);
            padding: 30px;
            margin: 30px auto;
            width: 90%;
            max-width: 600px;
        }

        .form-container h4 {
            color: #2c3e50;
            margin-top: 0;
            margin-bottom: 20px;
            font-size: 22px;
            font-weight: 600;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
            text-align: center;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #495057;
        }

        .form-control {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
            transition: all 0.3s;
            box-sizing: border-box;
        }

        .form-control:focus {
            border-color: #3498db;
            outline: none;
            box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
        }

        .text-danger {
            color: #dc3545;
            font-size: 13px;
            margin-top: 5px;
            display: block;
        }

        .validation-summary-errors {
            color: #dc3545;
            background-color: #f8d7da;
            border: 1px solid #f5c6cb;
            border-radius: 4px;
            padding: 10px;
            margin-bottom: 20px;
        }

        .validation-summary-errors ul {
            margin: 0;
            padding-left: 20px;
        }

        /* 按钮样式 */
        .btn-container {
            display: flex;
            gap: 10px;
            margin-top: 20px;
        }

        .btn {
            display: inline-block;
            padding: 10px 20px;
            border-radius: 4px;
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            border: none;
            text-align: center;
        }

        .btn-primary {
            background-color: #3498db;
            color: white;
        }

        .btn-primary:hover {
            background-color: #2980b9;
        }

        .btn-secondary {
            background-color: #6c757d;
            color: white;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
        }

        /* 页脚样式 */
        #footer {
            text-align: center;
            color: #6c757d;
            padding: 20px 0;
            font-size: 14px;
            margin-top: 30px;
            border-top: 1px solid #eee;
        }

    </style>
</head>
<body>
    <div id="all">
        <!--页眉-->
        <div id="header">
            <div id="logo"><span id="logotxt">广软智慧书城</span></div>
            <div id="loginmsg">
                @Html.ActionLink("退出", "Index", "ShopInfo")
            </div>
        </div>

        <!-- 导航菜单 -->
        <div id="menu">
            <ul>
                <li><a href="/OrderInfo/Index">订单管理</a></li>
                <li><a href="/CapitalAdvanc/Index">账户管理</a></li>
                <li><a href="/BookDetailsInfo/GetBookList">书籍管理</a></li>
                <li><a href="/ShopInfo/GetShopList">客户管理</a></li>
                <li><a href="/AdministrationInfo/GetAdmin">管理员管理</a></li>
            </ul>
        </div>

        <!-- 主要内容 -->
        <div class="container">
            <div class="form-container">
                @using (Html.BeginForm())
                {
                    @Html.AntiForgeryToken()

                    @Html.ValidationSummary(true, "", new { @class = "validation-summary-errors" })

                    <h4>添加管理员</h4>
                    <hr />

                    <div class="form-group">
                        <label for="AdminName">姓名</label>
                        @Html.EditorFor(model => model.AdminName, new
                   {
                       htmlAttributes = new
                       {
                           @class = "form-control",
                           placeholder = "请输入管理员姓名"
                       }
                   })
                        @Html.ValidationMessageFor(model => model.AdminName, "", new { @class = "text-danger" })
                    </div>

                    <div class="form-group">
                        <label for="AdminLogIn">账号</label>
                        @Html.EditorFor(model => model.AdminLogIn, new
                   {
                       htmlAttributes = new
                       {
                           @class = "form-control",
                           placeholder = "设置登录账号"
                       }
                   })
                        @Html.ValidationMessageFor(model => model.AdminLogIn, "", new { @class = "text-danger" })
                    </div>

                    <div class="form-group">
                        <label for="Adminpassword">密码</label>
                        @Html.EditorFor(model => model.Adminpassword, new
                   {
                       htmlAttributes = new
                       {
                           @class = "form-control",
                           type = "password",
                           placeholder = "设置登录密码"
                       }
                   })
                        @Html.ValidationMessageFor(model => model.Adminpassword, "", new { @class = "text-danger" })
                    </div>

                    <div class="form-group">
                        <label for="AdminPhone">电话</label>
                        @Html.EditorFor(model => model.AdminPhone, new
                   {
                       htmlAttributes = new
                       {
                           @class = "form-control",
                           placeholder = "11位手机号码",
                           type = "tel"
                       }
                   })
                        @Html.ValidationMessageFor(model => model.AdminPhone, "", new { @class = "text-danger" })
                    </div>

                    <div class="form-group">
                        <label for="AdminMall">邮箱</label>
                        @Html.EditorFor(model => model.AdminMall, new
                   {
                       htmlAttributes = new
                       {
                           @class = "form-control",
                           placeholder = "example@domain.com",
                           type = "email"
                       }
                   })
                        @Html.ValidationMessageFor(model => model.AdminMall, "", new { @class = "text-danger" })
                    </div>

                    <div class="btn-container">
                        <input type="submit" value="添加管理员" class="btn btn-primary" />
                        @Html.ActionLink("返回列表", "GetAdmin", null, new { @class = "btn btn-secondary" })
                    </div>
                }
            </div>
        </div>

        <!--页脚-->
        <div id="footer">
            <hr style="margin:20px 0px;" />
            广软智慧书城书城管理系统 &copy; @DateTime.Now.Year
        </div>
    </div>

    <!-- 脚本引用 -->
    <script src="~/conjs/jquery-3.4.1.js"></script>
    <script src="~/conjs/bootstrap.js"></script>
    <script>
        // 客户端验证增强
        $(document).ready(function() {
            // 手机号格式验证
            $('input[name="AdminPhone"]').on('blur', function() {
                var phone = $(this).val();
                if (phone && !/^1[3-9]\d{9}$/.test(phone)) {
                    $(this).addClass('is-invalid');
                    $(this).next('.text-danger').text('请输入有效的11位手机号码');
                } else {
                    $(this).removeClass('is-invalid');
                }
            });

            // 邮箱格式验证

        });
    </script>
</body>
</html>